package com.hyt.it.ogt.kq.common.utils;

import cn.hutool.core.io.FileUtil;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class FileSearchUtils {


    public static void searchFile(String fileFolder,String javaFilePath,String xmlFilePath) {
        Map<String,Integer> map = new HashMap<>();

        List<File> files = FileUtil.loopFiles(fileFolder);
        files.stream().forEach(file -> {
            if (file.getPath().contains(javaFilePath) || file.getPath().contains(xmlFilePath)) {
                String fileName = file.getName();
                int counts = map.get(fileName)==null?0:map.get(fileName);
                map.put(fileName,++counts);
            }
        });

        //遍历大于1的文件名
        map.forEach((k,v)-> {
            if (v>1) {
                System.out.println(k + ", 重复个数：" + v);
            }
        });
    }

    public static void main(String[] args) {
        Integer n = 1;
        System.out.println(n.toString().equals("2"));
    }

}
